Merged [13770]: Enabled saving ICQ aliases set in Adium to the server. Fixes #466
[adiumx.git] / Gaim Service / ESGaimZephyrAccountViewController.m
blob574731098b91901073b2d9b47a952f425854155c
1 /* 
2  * Adium is the legal property of its developers, whose names are listed in the copyright file included
3  * with this source distribution.
4  * 
5  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6  * General Public License as published by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
11  * Public License for more details.
12  * 
13  * You should have received a copy of the GNU General Public License along with this program; if not,
14  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15  */
17 #import "ESGaimZephyrAccountViewController.h"
18 #import "ESGaimZephyrAccount.h"
19 #import <Adium/AIAccount.h>
21 @implementation ESGaimZephyrAccountViewController
23 - (NSString *)nibName{
24     return(@"ESGaimZephyrAccountView");
27 //Configure our controls
28 - (void)configureForAccount:(AIAccount *)inAccount
30     [super configureForAccount:inAccount];
31         
32         [checkBox_exportAnyone setState:[[account preferenceForKey:KEY_ZEPHYR_EXPORT_ANYONE group:GROUP_ACCOUNT_STATUS] boolValue]];
33         [checkBox_exportSubs setState:[[account preferenceForKey:KEY_ZEPHYR_EXPORT_SUBS group:GROUP_ACCOUNT_STATUS] boolValue]];
34         
35         [textField_exposure setStringValue:[account preferenceForKey:KEY_ZEPHYR_EXPOSURE group:GROUP_ACCOUNT_STATUS]];
36         [textField_encoding setStringValue:[account preferenceForKey:KEY_ZEPHYR_ENCODING group:GROUP_ACCOUNT_STATUS]];
39 - (IBAction)changedPreference:(id)sender
40 {       
41         if (sender == checkBox_exportAnyone){
42                 [account setPreference:[NSNumber numberWithBool:[sender state]]
43                                                 forKey:KEY_ZEPHYR_EXPORT_ANYONE
44                                                  group:GROUP_ACCOUNT_STATUS];
45                 
46         }else if (sender == checkBox_exportSubs){
47                 [account setPreference:[NSNumber numberWithBool:[sender state]]
48                                                 forKey:KEY_ZEPHYR_EXPORT_SUBS
49                                                  group:GROUP_ACCOUNT_STATUS];
50         }else{
51                 [super changedPreference:sender];
52         }
55 - (void)controlTextDidChange:(NSNotification *)notification
57         NSTextField *sender = [notification object];
58         if (sender == textField_exposure){
59                 NSString *exposure = [sender stringValue];
60                 [account setPreference:([exposure length] ? exposure : nil)
61                                                 forKey:KEY_ZEPHYR_EXPOSURE
62                                                  group:GROUP_ACCOUNT_STATUS];
63                 
64         }else if (sender == textField_encoding){
65                 NSString *encoding = [sender stringValue];
67                 [account setPreference:([encoding length] ? encoding : nil)
68                                                 forKey:KEY_ZEPHYR_ENCODING
69                                                  group:GROUP_ACCOUNT_STATUS];
70         }else{
71                 [super controlTextDidChange:notification];
72         }               
75 @end